#include<iostream.h>
#include"matrix.h"

int main()
{
	int x,n,ch;

	do
	{
		cout<<"\n\t\t M A I N    M E N U";
		cout<<"\n\t 1.  GAUSS JACOBI METHOD";
		cout<<"\n\t 2.  GAUSS SEIDAL METHOD";
		cout<<"\n\t 3.  EXIT";

		cout<<"\n\t Enter Your Choice : ";
		cin>>n;

		switch(n)
		{
			case 1 : {

                                 cout<<"\n Enter order of coeff. matrix(nxn) : ";
				 cin>>x;

                                 matrix A(x,x),B(x,1);

				 gen_matrix(A,B);

				 if(fabs(A.determinant())<0.0001) 
				 	cout<<"\n Matrix is not invertible...\n";
					
				 else
				 	A.gauss_jacobi(B);
					

				 break;
				 }

			case 2 :
				 {

                                 cout<<"\n Enter order of coeff. matrix(nxn) : ";
				 cin>>x;

                                 matrix A(x,x),B(x,1);

				 gen_matrix(A,B);

				 if(fabs(A.determinant())<0.0001) 
				 	cout<<"\n Matrix is not invertible...\n";
				 else
				 	A.gauss_seidal(B);
			
				 break;

				 }

			case 3 : cout<<"\n Terminated Successfully...\n";


		}
	}while(n!=3);
	
	return 0;
}
